package com.lyf.utils;

import cn.hutool.json.JSONObject;
import com.lyf.result.Result;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class ResponseResult {

    public static void sendResult(HttpServletResponse resp , Result result){
        Map<String,Object> map = new HashMap<>();
        JSONObject jo = new JSONObject();
        map.put("result",result);
        jo.putAll(map);
        try {
            resp.getWriter().println(jo.toString());//响应到浏览器
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
